<!-- 
  @Created by pangzg pangzg2@yusys.com.cn on 2020-4-13 13:56:49.
  @updated by
  @description 警示对象组管理
-->
<div>
  <yu-panel title="警示对象组管理">
    <yu-xform related-table-name="refTable" form-type="search">
      <yu-xform-group :column="4">
        <yu-xform-item label="警示组编号" placeholder="警示组编号" ctype="input" name="groupCode"></yu-xform-item>
        <yu-xform-item label="警示组名称" placeholder="警示组名称" ctype="input" name="groupName"></yu-xform-item>
      </yu-xform-group>
    </yu-xform>
    <yu-toolBar>
      <yu-button @click="addFn" v-if="addFnButton">新增</yu-button>
      <yu-button @click="modifyFn" v-if="updateFnButton">修改</yu-button>
      <yu-button @click="infoFn">详情</yu-button>
      <yu-button @click="deleteFn" v-if="deleteFnButton">删除</yu-button>
      <yu-button @click="groupTargetFn" v-if="groupTargetFnButton">警示组对象</yu-button>
    </yu-toolBar>
    <yu-xtable ref="refTable" row-number :data-url="dataUrl" selection-type="checkbox" @row-click="cellClick">
      <yu-xtable-column label="警示组编号" prop="groupCode"></yu-xtable-column>
      <yu-xtable-column label="警示组名称" prop="groupName" sortable></yu-xtable-column>
    </yu-xtable>
  </yu-panel>
  <yu-dialog :title="viewTitle" :visible.sync="dialogVisible">
    <yu-xform ref="refForm" v-model="formdata" label-width="120px">
      <yu-xform-group>
        <yu-xform-item label="警示组编号" :rules="rulesone"  ctype="input" maxlength="64" name="groupCode" :colspan="12" :disabled="!addFlag" ></yu-xform-item>
        <yu-xform-item label="警示组名称" ctype="input" maxlength="120" name="groupName" :colspan="12" rules="required"></yu-xform-item>
        <yu-xform-item label="备注" ctype="textarea" name="remark" maxlength="240" :colspan="24" :rows="3"></yu-xform-item>
      </yu-xform-group>
    </yu-xform>
    <div class="yu-grpButton">
      <yu-button v-show="cancelBtnShow" @click="cancelFn">取消</yu-button>
      <yu-button type="primary" v-if="!saveDisabled" @click="saveFn">保存</yu-button>
    </div>
  </yu-dialog>
  <yu-dialog title="警示组对象" :visible.sync="targetDialogVisible">
    <yu-xform related-table-name="refTargetTable" form-type="search" v-model="searchFormdata">
      <yu-xform-group :column="4">
        <yu-xform-item placeholder="对象编码" ctype="input" name="targetCode"></yu-xform-item>
        <yu-xform-item placeholder="对象名称" ctype="input" name="targetName"></yu-xform-item>
        <yu-xform-item placeholder="通知方式" ctype="select" name="alarmMode" data-code="USE_ALERTM_MODE"></yu-xform-item>
      </yu-xform-group>
    </yu-xform>
    <yu-toolBar>
      <yu-button @click="addTargetFn">新增对象</yu-button>
      <yu-button @click="deleteTargetFn">删除对象</yu-button>
    </yu-toolBar>
    <yu-xtable ref="refTargetTable" reserve-selection :row-key="getKey" row-number :data-url="dataGroupTargetUrl" selection-type="checkbox" @row-click="cellClickTargetTable" height="300px">
      <yu-xtable-column label="对象编码" prop="targetCode"></yu-xtable-column>
      <yu-xtable-column label="对象名称" prop="targetName" sortable></yu-xtable-column>
      <yu-xtable-column label="通知方式" prop="alarmMode" data-code="USE_ALERTM_MODE"></yu-xtable-column>
    </yu-xtable>
  </yu-dialog>
  <yu-dialog title="新增警示组对象" :visible.sync="addTargerDialogVisible" >
    <yu-xform related-table-name="refAddTargetTable" form-type="search" v-model="addSearchFormdata">
      <yu-xform-group :column="4">
        <yu-xform-item placeholder="对象编码" ctype="input" name="targetCode"></yu-xform-item>
        <yu-xform-item placeholder="对象名称" ctype="input" name="targetName"></yu-xform-item>
        <yu-xform-item placeholder="通知方式" ctype="select" name="alarmMode" data-code="USE_ALERTM_MODE"></yu-xform-item>
      </yu-xform-group>
    </yu-xform>
    <yu-xtable ref="refAddTargetTable" reserve-selection :row-key="getKey" row-number :data-url="dataTargetUrl" selection-type="checkbox" @row-click="cellClickAddTargetTable" height="300px">
      <yu-xtable-column label="对象编码" prop="targetCode"></yu-xtable-column>
      <yu-xtable-column label="对象名称" prop="targetName" sortable></yu-xtable-column>
      <yu-xtable-column label="通知方式" prop="alarmMode" data-code="USE_ALERTM_MODE"></yu-xtable-column>
    </yu-xtable>
    <div class="yu-grpButton">
      <yu-button @click="cancelAddTargetFn">取消</yu-button>
      <yu-button type="primary" @click="saveGroupMemberFn">保存</yu-button>
    </div>
  </yu-dialog>
</div>